package chapter06

import java.sql.{Connection, DriverManager, PreparedStatement, ResultSet}

object ThriftServer {
  def main(args: Array[String]): Unit = {
    try{ //加载驱动
      Class.forName("org.apache.hive.jdbc.HiveDriver")
      val conn: Connection = DriverManager
        .getConnection("jdbc:hive2://hadoop000:10000")

      val statement: PreparedStatement = conn.prepareStatement("select id,name from myhive.pk")

      val result: ResultSet = statement.executeQuery()
      while (result.next()){
        println(result.getObject(1)+" : "+result.getObject(2))
      }
    }


  }

}
